<?php
/*
 * @subpackage Core Pass input tag attributes as key value pairs. For a list of allowable attributes, see http://www.w3schools.com/tags/tag_input.asp @uses $vars['default'] The default value to submit if not checked. Optional, defaults to 0. Set to false for no default. @uses $vars['class'] Additional CSS class
 */
elgg_load_js('jquery-raty');
$star_on = elgg_normalize_url('mod/subjectmanage/graphics/star-on.png');
$star_off = elgg_normalize_url('mod/subjectmanage/graphics/star-off.png');
$star_half = elgg_normalize_url('mod/subjectmanage/graphics/star-half.png');
$star_cancel_on = elgg_normalize_url('mod/subjectmanage/graphics/cancel-on.png');
$star_cancel_off = elgg_normalize_url('mod/subjectmanage/graphics/cancel-off.png');

$defaults = array(
    'default' => 0,
    'disabled' => false
);

$vars = array_merge($defaults, $vars);

$default = $vars ['default'];
unset ($vars ['default']);
$name = "";

if (isset ($vars ['name'])) {
    $name = $vars ['name'];
} else {
    $name = "rating";
}

$num_star = $vars['num_star'];

// hidden input
$hidden_input = elgg_view('input/hidden', array(
    'name' => $name,
    'value' => '',
    'id' => 'hidden_rating_holder',
));

$raty = "<div id='raty_element'></div>
<script>
    $('#raty_element').raty({
        number: $num_star,
        half: true,
        cancel     : true,
        cancelHint : 'Cho điểm 0! Hehe',
        size   : 26,
        target : '#hidden_rating_holder',
        targetKeep : true,
        starOff :'$star_off',
        starOn  : '$star_on',
        starHalf: '$star_half',
        cancelOn: '$star_cancel_on',
        cancelOff:'$star_cancel_off'
    });
</script>
";

echo $hidden_input;
echo $raty;



